package artid.com.arttogoa.adapter;

import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import artid.com.arttogoa.R;
import artid.com.arttogoa.parser.MyFansParser;
import artid.com.arttogoa.util.CircleImageView;
import com.nostra13.universalimageloader.core.ImageLoader;
/**
 * 
*    
* 项目名称：ArtworkArtA   
* 类名称   ：MyFansAdapter   
* 类描述   ：我的粉丝适配器  
* 创建人   ：耿卫斌   
* 创建时间：2016-5-23 下午1:22:04   
*
 */
public class MyFansAdapter extends BaseAdapter {
	private Context mContext;
	private List<MyFansParser> list;

	public MyFansAdapter(Context mContext,List<MyFansParser> list) {
		super();
		this.mContext = mContext;
		this.list = list;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
			ViewHolder holder = null;
			View v = convertView;
			if (v == null) {
				holder = new ViewHolder();
				v = LayoutInflater.from(mContext).inflate(R.layout.item_my_fans, null);
				holder.icon=(CircleImageView) v.findViewById(R.id.itemMyFans_icon);
				holder.name=(TextView) v.findViewById(R.id.itemMyFans_name);
				holder.num=(TextView) v.findViewById(R.id.itemMyFans_likeNum);
				v.setTag(holder);
			} else {
				holder = (ViewHolder) v.getTag();
			}
			ImageLoader.getInstance().displayImage(list.get(position).getAvatarurl(), holder.icon);
			holder.name.setText(list.get(position).getName());
			holder.num.setText("点赞 "+list.get(position).getCommend_num());
			return v;
		}
		class ViewHolder {
			CircleImageView icon;
			TextView name,num;
		}

}
